package com.tuling.common;

import lombok.Data;

@Data
public class Result<T> {

    private boolean success;

    private T Data;

    private String message;

    public Result(boolean success, T data, String message) {
        this.success = success;
        Data = data;
        this.message = message;
    }

    public Result(boolean success, String message) {
        this.success = success;
        this.message = message;
    }

    public static <T> Result<T> ok(T object) {
        return new Result<T>(true, object, "成功");
    }

    public static <T> Result<T> fail(String message) {
        return new Result<T>(false, message);
    }
}
